home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 21
/
Cream of the Crop 21 (Terry Blount) (October 1996).iso
/
os2
/
e33el2.zip
/
emacs
/
19.33
/
lisp
/
ediff-mult.el
< prev
next >
Wrap
Text File
|
1996-07-02
|
60KB
|
1,626 lines
;;; ediff-mult.el --- support for multi-file/multi-buffer processing in Ediff
;; Copyright (C) 1995, 1996 Free Software Foundation, Inc.
;; Author: Michael Kifer <kifer@cs.sunysb.edu>
;; This file is part of GNU Emacs.
;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
;;; Commentary:
;; Users are encouraged to add functionality to this file.
;; The present file contains all the infrastructure needed for that.
;;
;; Generally, to to implement a new multisession capability within Ediff,
;; you need to tell it
;;
;; 1. How to display the session group buffer.
;; This function must indicate which Ediff sessions are active (+) and
;; which are finished (-).
;; See ediff-redraw-directory-group-buffer for an example.
;; In all likelihood, ediff-redraw-directory-group-buffer can be used
;; directly or after a small modification.
;; 2. What action to take when the user clicks button 2 or types v,e, or
;; RET. See ediff-filegroup-action.
;; 3. Provide a list of pairs or triples of file names (or buffers,
;; depending on the particular Ediff operation you want to invoke)
;; in the following format:
;; (descriptor (obj1 obj2 obj3) (...) ...)
;; Actually, the format of this list is pretty much up to the
;; developer. The only thing is that it must be a list of lists,
;; and the first list must describe the meta session, and subsequent
;; elements must describe individual sessions.
;; This descriptor must be a list of two, three, or four elements (nil
;; or string). The function ediff-redraw-registry-buffer displays the
;; second through last of these in the registry buffer.
;; Also, keep in mind that the function ediff-prepare-meta-buffer
;; (which see) prepends the session group buffer to the descriptor and
;; nil in front of each subsequent list (i.e., the above list
;; will become
;; ((meta-buf descriptor) (nil obj1 obj2 obj3) (nil ...) ...)
;; Ediff expects that your function (in 2 above) will arrange to
;; replace this prepended nil (via setcar) with the actual ediff
;; control buffer associated with an appropriate Ediff session.
;; This is arranged through internal startup hooks that can be passed
;; to any of Ediff major entries (such as ediff-files, epatch, etc.).
;; See how this is done in ediff-filegroup-action.
;;
;; Session descriptions are of the form (obj1 obj2 obj3), which
;; describe objects relevant to the session. Usually they are names of
;; files, but sometimes they may be other things. For instance, obj3 is
;; nil for jobs that involve only two files. For patch jobs, obj2 and
;; obj3 are markers that specify the patch corresponding to the file
;; (whose name is obj1).
;; 4. Write a function that makes a call to ediff-prepare-meta-buffer
;; passing all this info.
;; You may be able to use ediff-directories-internal as a template.
;; 5. If you intend to add several related pieces of functionality,
;; you may want to keep the function in 4 as an internal version
;; and then write several top-level interactive functions that call it
;; with different parameters.
;; See how ediff-directories, ediff-merge-directories, and
;; ediff-merge-directories-with-ancestor all use
;; ediff-directories-internal.
;;
;; A useful addition here could be session groups selected by patterns
;; (which are different in each directory). For instance, one may want to
;; compare files of the form abc{something}.c to files old{something}.d
;; which may be in the same or different directories. Or, one may want to
;; compare all files of the form {something} to files of the form {something}~.
;;
;; Implementing this requires writing an collating function, which should pair
;; up appropriate files. It will also require a generalization of the functions
;; that do the layout of the meta- and differences buffers and of
;; ediff-filegroup-action.
;;; Code:
(require 'ediff-init)
;; meta-buffer
(ediff-defvar-local ediff-meta-buffer nil "")
(ediff-defvar-local ediff-parent-meta-buffer nil "")
;; the registry buffer
(defvar ediff-registry-buffer nil)
(defconst ediff-meta-buffer-message "This is an Ediff Session Group Panel: %s
Useful commands:
button2, `v', RET over a session line: start that Ediff session
`M':\tin any session invoked from here, brings back this group panel
`R':\tdisplay the registry of active Ediff sessions
`h':\tmark session for hiding (toggle)
`x':\thide marked sessions; with prefix arg--unhide hidden sessions
`m':\tmark session for a non-hiding operation (toggle)
SPC:\tnext session
DEL:\tprevious session
`E':\tbrowse Ediff on-line manual
`q':\tquit this session group
")
(ediff-defvar-local ediff-meta-buffer-map nil
"The keymap for the meta buffer.")
(defvar ediff-dir-diffs-buffer-map (make-sparse-keymap)
"The keymap to be installed in the buffer showing differences between
directories.")
;; Variable specifying the action to take when the use invokes ediff in the
;; meta buffer. This is usually ediff-registry-action or ediff-filegroup-action
(ediff-defvar-local ediff-meta-action-function nil "")
;; Tells ediff-update-meta-buffer how to redraw it
(ediff-defvar-local ediff-meta-redraw-function nil "")
;; Tells ediff-filegroup-action and similar procedures how to invoke Ediff for
;; the sessions in a given session group
(ediff-defvar-local ediff-session-action-function nil "")
(ediff-defvar-local ediff-metajob-name nil "")
;; buffer used to collect custom diffs from individual sessions in the group
(ediff-defvar-local ediff-meta-diff-buffer nil "")
;; history var to use for filtering groups
(defvar ediff-filtering-regexp-history nil "")
;; This has the form ((ctl-buf file1 file2) (stl-buf file1 file2) ...)
;; If ctl-buf is nil, the file-pair wasn't processed yet. If it is
;; killed-buffer object, the file pair has been processed. If it is a live
;; buffer, this means ediff is still working on the pair
(ediff-defvar-local ediff-meta-list nil "")
;; the difference list between directories in a directory session group
(ediff-defvar-local ediff-dir-difference-list nil "")
(ediff-defvar-local ediff-dir-diffs-buffer nil "")
;; The registry of Ediff sessions. A list of control buffers.
(defvar ediff-session-registry nil)
(defvar ediff-registry-setup-hook nil
"*Hooks run just after the registry control panel is set up.")
(defvar ediff-session-group-setup-hook nil
"*Hooks run just after a meta-buffer controlling a session group, such as
ediff-directories, is run.")
(defvar ediff-show-registry-hook nil
"*Hooks run just after the registry buffer is shown.")
(defvar ediff-show-session-group-hook nil
"*Hooks run just after a session group buffer is shown.")
;; buffer holding the multi-file patch. local to the meta buffer
(ediff-defvar-local ediff-meta-patchbufer nil "")
;;; API for ediff-meta-list
;; group buffer/regexp
(defun ediff-get-group-buffer (meta-list)
(nth 0 (car meta-list)))
(defun ediff-get-group-regexp (meta-list)
(nth 1 (car meta-list)))
;; group objects
(defun ediff-get-group-objA (meta-list)
(nth 2 (car meta-list)))
(defun ediff-get-group-objB (meta-list)
(nth 3 (car meta-list)))
(defun ediff-get-group-objC (meta-list)
(nth 4 (car meta-list)))
;; session buffer
(defun ediff-get-session-buff